VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmRepAlmacen 
   Caption         =   "Form1"
   ClientHeight    =   5910
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8325
   BeginProperty Font 
      Name            =   "Arial"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   5910
   ScaleWidth      =   8325
   StartUpPosition =   3  'Windows Default
   Begin VB.ComboBox Combo3 
      Height          =   315
      Left            =   1320
      TabIndex        =   13
      Text            =   "Combo1"
      Top             =   4440
      Width           =   3735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Salir"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4680
      TabIndex        =   12
      Top             =   5280
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Ver Reporte"
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1200
      TabIndex        =   11
      Top             =   5280
      Width           =   1935
   End
   Begin VB.ComboBox Combo2 
      Height          =   315
      Left            =   1320
      TabIndex        =   10
      Text            =   "Combo1"
      Top             =   3600
      Width           =   3735
   End
   Begin VB.ComboBox Combo1 
      Height          =   315
      Left            =   1320
      TabIndex        =   8
      Text            =   "Combo1"
      Top             =   2760
      Width           =   3735
   End
   Begin MSComCtl2.DTPicker DTPicker1 
      Height          =   495
      Left            =   1320
      TabIndex        =   4
      Top             =   1800
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   873
      _Version        =   393216
      Format          =   245563393
      CurrentDate     =   40767
   End
   Begin VB.OptionButton Option3 
      Caption         =   "Existencia"
      Height          =   495
      Left            =   3240
      TabIndex        =   2
      Top             =   0
      Width           =   1215
   End
   Begin VB.OptionButton Option2 
      Caption         =   "Descargas"
      Height          =   495
      Left            =   1680
      TabIndex        =   1
      Top             =   0
      Width           =   1215
   End
   Begin VB.OptionButton Option1 
      Caption         =   "Compras"
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   1215
   End
   Begin MSComCtl2.DTPicker DTPicker2 
      Height          =   495
      Left            =   3960
      TabIndex        =   6
      Top             =   1800
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   873
      _Version        =   393216
      Format          =   245563393
      CurrentDate     =   40767
   End
   Begin VB.Label SkinLabel1 
      Height          =   375
      Left            =   1320
      TabIndex        =   3
      Top             =   1560
      Width           =   2535
   End
   Begin VB.Label SkinLabel2 
      Height          =   375
      Left            =   3960
      TabIndex        =   5
      Top             =   1560
      Width           =   2535
   End
   Begin VB.Label SkinLabel3 
      Height          =   375
      Left            =   1320
      TabIndex        =   7
      Top             =   2400
      Width           =   2535
   End
   Begin VB.Label SkinLabel4 
      Height          =   375
      Left            =   1320
      TabIndex        =   9
      Top             =   3240
      Width           =   2535
   End
   Begin VB.Label SkinLabel5 
      Height          =   375
      Left            =   1320
      TabIndex        =   14
      Top             =   4080
      Width           =   2535
   End
End
Attribute VB_Name = "frmRepAlmacen"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim tabla As String
Dim Reporte As CRAXDDRT.report
Sub Limpiar()
    DTPicker1.Value = Date
    DTPicker2.Value = Date
End Sub
Sub BloqueaFiltros(st As Boolean)
Combo1.Enabled = st
DTPicker1.Enabled = st
DTPicker2.Enabled = st
End Sub
Function ObtFiltro()
    filtro = ""
    f1 = "#" & FormatoFecha(DTPicker1.Value) & "#"
    f2 = "#" & FormatoFecha(DTPicker2.Value) & "#"
    If Option1.Value Or Option2.Value Then
        filtro = tabla & ".fecha}>=" & f1 & " and " & tabla & ".fecha} <=" & f2
        If Combo1.Text <> "" Then
            filtro = filtro & " AND {Almacen_Proveedor.razon_social}='" & Combo1.Text & "'"
        End If
        If Combo2.Text <> "" Then
            filtro = filtro & " AND {Almacen_Materiales.descripcion}='" & Combo2.Text & "'"
        End If
        If Combo3.Text <> "" Then
            filtro = filtro & " AND " & tabla & ".Usuario}='" & Combo3.Text & "'"
        End If
    Else
        If Combo2.Text <> "" Then
            filtro = filtro & " {Almacen_Materiales.descripcion}='" & Combo2.Text & "'"
        End If
    End If
    ObtFiltro = filtro
End Function

Private Sub Command1_Click()
    'Un'Load 'FrmReporte
    'Load 'FrmReporte

    'Un'Load 'FrmReporte
'    If Option1.Value Then 'Set 'FrmReporte.Report = New rptCompras
'    If Option2.Value Then 'Set 'FrmReporte.Report = New rptDescarga
'    If Option3.Value Then 'Set 'FrmReporte.Report = New rptExistencia

    filtro = ObtFiltro
    'FrmReporte.Report.PaperSize = crPaperLetter
'    MsgBox filtro
    'FrmReporte.Report.RecordSelectionFormula = filtro
    'FrmReporte.Show vbModal
    
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
LlenarCombo Combo1, "select [razon_social]from Almacen_Proveedor"
LlenarCombo Combo2, "select [descripcion]from almacen_materiales"
LlenarCombo Combo3, "select [identifica]from cajero"
Me.Caption = MdlFunciones.titulo("Reporte de Almacen")
Limpiar
End Sub

Private Sub Option1_Click()
'Set 'FrmReporte.Report = New rptCompras
tabla = "{Almacen_Compra"
BloqueaFiltros True
End Sub

Private Sub Option2_Click()
tabla = "{Almacen_Descarga"
BloqueaFiltros True
Combo1.Enabled = False
End Sub

Private Sub Option3_Click()
tabla = "{Almacen_Materiales"
BloqueaFiltros False
End Sub
